Data Processing#
In our workflow, we leverage TorchGeo to implement datasets and data modules, ensuring robust and flexible data handling. For a deeper dive into working with datasets using TorchGeo, please refer to the TorchGeo tutorials on datasets.
In most cases, it’s best to create a custom TorchGeo dataset tailored to your specific data. Doing so gives you complete control over: - Data Loading: Customize how your data is read and organized. - Transforms: Decide which preprocessing or augmentation steps to apply. - Visualization: Define custom plotting methods (for example, when logging with TensorBoard).
TorchGeo offers two primary classes to suit different data formats:
- NonGeoDataset:
Use this if your dataset is already split into neatly tiled pieces ready for neural network consumption. Essentially, NonGeoDataset is a wrapper around a standard PyTorch dataset, making it straightforward to integrate into your pipeline.
- GeoDataset:
Opt for this class if your data comes in the form of large GeoTiff files from which you need to sample during training. GeoDataset automatically aligns your input data with corresponding labels and supports a range of geo-aware sampling techniques.
In addition to these specialized TorchGeo datasets, TerraTorch offers generic datasets and data modules designed to work with directory-based data structures, similar to those used in MMLab libraries. These generic tools simplify data loading when your data is organized in conventional file directories: - The Generic Pixel-wise Dataset is ideal for tasks where each pixel represents a sample (e.g., segmentation or dense prediction problems). - The Generic Scalar Label Dataset is best suited for classification tasks where each sample is associated with a single label.
TerraTorch also provides corresponding generic data modules that bundle the dataset with training, validation, and testing splits, integrating seamlessly with PyTorch Lightning. This arrangement makes it easy to manage data loading, batching, and preprocessing with minimal configuration.
While generic datasets offer a quick start for common data structures, many projects require more tailored solutions. Custom datasets and data modules give you complete control over the entire data handling process—from fine-tuned data loading and specific transformations to enhanced visualization. By developing your own dataset and data module classes, you ensure that every step—from data ingestion to final model input—is optimized for your particular use case. TerraTorch’s examples provide an excellent starting point to build these custom components and integrate them seamlessly into your training pipeline.
For additional examples on fine-tuning a TerraTorch model using these components, please refer to the Prithvi EO Examples repository.
Data curation#
Generally speaking, all the datamodules work by collecting sets of files and concatenating them into batches
with a size determined by the user. TerraTorch automatically checks the dimensionality of the files in order
to guarantee that they are stackable, otherwise a stackability error will be raised. If you are sure that your
data files are in the proper format and do not want to
check for stackability, define check_stackability: false in the field data of your yaml file. If you are using
the script interface, you just need to pass it as argument to your dataloader class. Alternatively, if you
want to fix discrepancies related to dimensionality in your input files at the data loading stage, you can add a
pad correction pipeline, as seen in the example tests/resources/configs/manufactured-finetune_prithvi_eo_v2_300_pad_transform.yaml.
Using Datasets already implemented in TorchGeo#
Using existing TorchGeo DataModules is very easy! Just plug them in!
For instance, to use the EuroSATDataModule, in your config file, set the data as:
data:
class_path: torchgeo.datamodules.EuroSATDataModule
init_args:
batch_size: 32
num_workers: 8
dict_kwargs:
root: /dccstor/geofm-pre/EuroSat
download: True
bands:
- B02
- B03
- B04
- B08A
- B09
- B10
You can also do this outside of config files! Simply instantiate the data module as normal and plug it in.
Warning
To define transforms to be passed to DataModules from TorchGeo from config files, you must use the following format:
data:
class_path: terratorch.datamodules.TorchNonGeoDataModule
init_args:
cls: torchgeo.datamodules.EuroSATDataModule
transforms:
- class_path: albumentations.augmentations.geometric.resize.Resize
init_args:
height: 224
width: 224
- class_path: ToTensorV2
TorchNonGeoDataModule and the class to be used is passed through cls (there is also a TorchGeoDataModule for geo modules).
This has to be done as the transforms argument is passed through **kwargs in TorchGeo, making it difficult to instantiate with LightningCLI.
See more details below.
terratorch.datamodules.torchgeo_data_module
#
Ugly proxy objects so parsing config file works with transforms.
These are necessary since, for LightningCLI to instantiate arguments as objects from the config, they must have type annotations
In TorchGeo, transforms is passed in **kwargs, so it has no type annotations!
To get around that, we create these wrappers that have transforms type annotated.
They create the transforms and forward all method and attribute calls to the
original TorchGeo datamodule.
Additionally, TorchGeo datasets pass the data to the transforms callable as a dict, and as a tensor.
Albumentations expects this data not as a dict but as different key-value arguments, and as numpy. We handle that conversion here.
TorchGeoDataModule
#
Bases: GeoDataModule
Proxy object for using Geo data modules defined by TorchGeo.
Allows for transforms to be defined and passed using config files. The only reason this class exists is so that we can annotate the transforms argument with a type. This is required for lightningcli and config files. As such, all getattr and setattr will be redirected to the underlying class.
Source code in terratorch/datamodules/torchgeo_data_module.py
__init__(cls, batch_size=None, num_workers=0, transforms=None, **kwargs)
#
Constructor
| Parameters: |
|
|---|
Source code in terratorch/datamodules/torchgeo_data_module.py
TorchNonGeoDataModule
#
Bases: NonGeoDataModule
Proxy object for using NonGeo data modules defined by TorchGeo.
Allows for transforms to be defined and passed using config files. The only reason this class exists is so that we can annotate the transforms argument with a type. This is required for lightningcli and config files. As such, all getattr and setattr will be redirected to the underlying class.
Source code in terratorch/datamodules/torchgeo_data_module.py
__init__(cls, batch_size=None, num_workers=0, transforms=None, **kwargs)
#
Constructor
| Parameters: |
|
|---|
Source code in terratorch/datamodules/torchgeo_data_module.py
Generic datasets and data modules#
For the NonGeoDataset case, we also provide "generic" datasets and datamodules. These can be used when you would like to load data from given directories, in a style similar to the MMLab libraries.
Generic Datasets#
terratorch.datasets.generic_pixel_wise_dataset
#
Module containing generic dataset classes
GenericNonGeoPixelwiseRegressionDataset
#
Bases: GenericPixelWiseDataset
GenericNonGeoPixelwiseRegressionDataset
Source code in terratorch/datasets/generic_pixel_wise_dataset.py
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 | |
__init__(data_root, label_data_root=None, image_grep='*', label_grep='*', split=None, ignore_split_file_extensions=True, allow_substring_split_file=True, rgb_indices=None, dataset_bands=None, output_bands=None, constant_scale=1, transform=None, no_data_replace=None, no_label_replace=None, expand_temporal_dimension=False, reduce_zero_label=False)
#
Constructor
| Parameters: |
|
|---|
Source code in terratorch/datasets/generic_pixel_wise_dataset.py
plot(sample, suptitle=None)
#
Plot a sample from the dataset.
| Parameters: |
|
|---|
| Returns: |
|
|---|
.. versionadded:: 0.2
Source code in terratorch/datasets/generic_pixel_wise_dataset.py
GenericNonGeoSegmentationDataset
#
Bases: GenericPixelWiseDataset
GenericNonGeoSegmentationDataset
Source code in terratorch/datasets/generic_pixel_wise_dataset.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | |
__init__(data_root, num_classes, label_data_root=None, image_grep='*', label_grep='*', split=None, ignore_split_file_extensions=True, allow_substring_split_file=True, rgb_indices=None, dataset_bands=None, output_bands=None, class_names=None, constant_scale=1, transform=None, no_data_replace=None, no_label_replace=None, expand_temporal_dimension=False, reduce_zero_label=False)
#
Constructor
| Parameters: |
|
|---|
Source code in terratorch/datasets/generic_pixel_wise_dataset.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | |
plot(sample, suptitle=None)
#
Plot a sample from the dataset.
| Parameters: |
|
|---|
| Returns: |
|
|---|
.. versionadded:: 0.2
Source code in terratorch/datasets/generic_pixel_wise_dataset.py
GenericPixelWiseDataset
#
Bases: NonGeoDataset, ABC
This is a generic dataset class to be used for instantiating datasets from arguments. Ideally, one would create a dataset class specific to a dataset.
Source code in terratorch/datasets/generic_pixel_wise_dataset.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | |
__init__(data_root, label_data_root=None, image_grep='*', label_grep='*', split=None, ignore_split_file_extensions=True, allow_substring_split_file=True, rgb_indices=None, dataset_bands=None, output_bands=None, constant_scale=1, transform=None, no_data_replace=None, no_label_replace=None, expand_temporal_dimension=False, reduce_zero_label=False)
#
Constructor
| Parameters: |
|
|---|
Source code in terratorch/datasets/generic_pixel_wise_dataset.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | |
terratorch.datasets.generic_scalar_label_dataset
#
Module containing generic dataset classes
GenericNonGeoClassificationDataset
#
Bases: GenericScalarLabelDataset
GenericNonGeoClassificationDataset
Source code in terratorch/datasets/generic_scalar_label_dataset.py
__init__(data_root, num_classes, split=None, ignore_split_file_extensions=True, allow_substring_split_file=True, rgb_indices=None, dataset_bands=None, output_bands=None, class_names=None, constant_scale=1, transform=None, no_data_replace=0, expand_temporal_dimension=False)
#
A generic Non-Geo dataset for classification.
| Parameters: |
|
|---|
Source code in terratorch/datasets/generic_scalar_label_dataset.py
GenericScalarLabelDataset
#
Bases: NonGeoDataset, ImageFolder, ABC
This is a generic dataset class to be used for instantiating datasets from arguments. Ideally, one would create a dataset class specific to a dataset.
Source code in terratorch/datasets/generic_scalar_label_dataset.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | |
__init__(data_root, split=None, ignore_split_file_extensions=True, allow_substring_split_file=True, rgb_indices=None, dataset_bands=None, output_bands=None, constant_scale=1, transform=None, no_data_replace=0, expand_temporal_dimension=False)
#
Constructor
| Parameters: |
|
|---|
Source code in terratorch/datasets/generic_scalar_label_dataset.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
Generic Data Modules#
terratorch.datamodules.generic_pixel_wise_data_module
#
This module contains generic data modules for instantiation at runtime.
GenericNonGeoPixelwiseRegressionDataModule
#
Bases: NonGeoDataModule
This is a generic datamodule class for instantiating data modules at runtime. Composes several GenericNonGeoPixelwiseRegressionDataset
Source code in terratorch/datamodules/generic_pixel_wise_data_module.py
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 | |
__init__(batch_size, num_workers, train_data_root, val_data_root, test_data_root, means, stds, predict_data_root=None, img_grep='*', label_grep='*', train_label_data_root=None, val_label_data_root=None, test_label_data_root=None, train_split=None, val_split=None, test_split=None, ignore_split_file_extensions=True, allow_substring_split_file=True, dataset_bands=None, output_bands=None, predict_dataset_bands=None, predict_output_bands=None, constant_scale=1, rgb_indices=None, train_transform=None, val_transform=None, test_transform=None, expand_temporal_dimension=False, reduce_zero_label=False, no_data_replace=None, no_label_replace=None, drop_last=True, pin_memory=False, check_stackability=True, **kwargs)
#
Constructor
| Parameters: |
|
|---|
Source code in terratorch/datamodules/generic_pixel_wise_data_module.py
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | |
GenericNonGeoSegmentationDataModule
#
Bases: NonGeoDataModule
This is a generic datamodule class for instantiating data modules at runtime. Composes several GenericNonGeoSegmentationDatasets
Source code in terratorch/datamodules/generic_pixel_wise_data_module.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | |
__init__(batch_size, num_workers, train_data_root, val_data_root, test_data_root, img_grep, label_grep, means, stds, num_classes, predict_data_root=None, train_label_data_root=None, val_label_data_root=None, test_label_data_root=None, train_split=None, val_split=None, test_split=None, ignore_split_file_extensions=True, allow_substring_split_file=True, dataset_bands=None, output_bands=None, predict_dataset_bands=None, predict_output_bands=None, constant_scale=1, rgb_indices=None, train_transform=None, val_transform=None, test_transform=None, expand_temporal_dimension=False, reduce_zero_label=False, no_data_replace=None, no_label_replace=None, drop_last=True, pin_memory=False, **kwargs)
#
Constructor
| Parameters: |
|
|---|
Source code in terratorch/datamodules/generic_pixel_wise_data_module.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | |
terratorch.datamodules.generic_scalar_label_data_module
#
This module contains generic data modules for instantiation at runtime.
GenericNonGeoClassificationDataModule
#
Bases: NonGeoDataModule
This is a generic datamodule class for instantiating data modules at runtime. Composes several GenericNonGeoClassificationDatasets
Source code in terratorch/datamodules/generic_scalar_label_data_module.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | |
__init__(batch_size, num_workers, train_data_root, val_data_root, test_data_root, means, stds, num_classes, predict_data_root=None, train_split=None, val_split=None, test_split=None, ignore_split_file_extensions=True, allow_substring_split_file=True, dataset_bands=None, predict_dataset_bands=None, output_bands=None, constant_scale=1, rgb_indices=None, train_transform=None, val_transform=None, test_transform=None, expand_temporal_dimension=False, no_data_replace=0, drop_last=True, check_stackability=True, **kwargs)
#
Constructor
| Parameters: |
|
|---|
Source code in terratorch/datamodules/generic_scalar_label_data_module.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |
Custom datasets and data modules#
Our custom datasets and data modules are crafted to handle specific data, offering enhanced control and flexibility throughout the workflow. In case you want to use TerraTorch on your specific data, we invite you to develop your own dataset and data module classes by following the examples below.
Datasets#
terratorch.datasets.biomassters
#
BioMasstersNonGeo
#
Bases: BioMassters
BioMassters Dataset for Aboveground Biomass prediction.
Dataset intended for Aboveground Biomass (AGB) prediction over Finnish forests based on Sentinel 1 and 2 data with corresponding target AGB mask values generated by Light Detection and Ranging (LiDAR).
Dataset Format:
- .tif files for Sentinel 1 and 2 data
- .tif file for pixel wise AGB target mask
- .csv files for metadata regarding features and targets
Dataset Features:
- 13,000 target AGB masks of size (256x256px)
- 12 months of data per target mask
- Sentinel 1 and Sentinel 2 data for each location
- Sentinel 1 available for every month
- Sentinel 2 available for almost every month (not available for every month due to ESA acquisition halt over the region during particular periods)
If you use this dataset in your research, please cite the following paper:
- https://nascetti-a.github.io/BioMasster/
.. versionadded:: 0.5
Source code in terratorch/datasets/biomassters.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | |
__init__(root='data', split='train', bands=BAND_SETS['all'], transform=None, mask_mean=63.4584, mask_std=72.21242, sensors=['S1', 'S2'], as_time_series=False, metadata_filename=default_metadata_filename, max_cloud_percentage=None, max_red_mean=None, include_corrupt=True, subset=1, seed=42, use_four_frames=False)
#
Initialize a new instance of BioMassters dataset.
If as_time_series=False (the default), each time step becomes its own
sample with the target being shared across multiple samples.
| Parameters: |
|
|---|
| Raises: |
|
|---|
Source code in terratorch/datasets/biomassters.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
plot(sample, show_titles=True, suptitle=None)
#
Plot a sample from the dataset.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in terratorch/datasets/biomassters.py
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | |
terratorch.datasets.burn_intensity
#
BurnIntensityNonGeo
#
Bases: NonGeoDataset
Dataset implementation for Burn Intensity classification.
Source code in terratorch/datasets/burn_intensity.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | |
__init__(data_root, split='train', bands=BAND_SETS['all'], transform=None, use_full_data=True, no_data_replace=0.0001, no_label_replace=-1, use_metadata=False)
#
Initialize the BurnIntensity dataset.
| Parameters: |
|
|---|
Source code in terratorch/datasets/burn_intensity.py
plot(sample, suptitle=None)
#
Plot a sample from the dataset.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in terratorch/datasets/burn_intensity.py
terratorch.datasets.carbonflux
#
CarbonFluxNonGeo
#
Bases: NonGeoDataset
Dataset for Carbon Flux regression from HLS images and MERRA data.
Source code in terratorch/datasets/carbonflux.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | |
__init__(data_root, split='train', bands=BAND_SETS['all'], transform=None, gpp_mean=None, gpp_std=None, no_data_replace=0.0001, use_metadata=False, modalities=('image', 'merra_vars'))
#
Initialize the CarbonFluxNonGeo dataset.
| Parameters: |
|
|---|
Source code in terratorch/datasets/carbonflux.py
plot(sample, suptitle=None)
#
Plot a sample from the dataset.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in terratorch/datasets/carbonflux.py
terratorch.datasets.forestnet
#
ForestNetNonGeo
#
Bases: NonGeoDataset
NonGeo dataset implementation for ForestNet.
Source code in terratorch/datasets/forestnet.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | |
__init__(data_root, split='train', label_map=default_label_map, transform=None, fraction=1.0, bands=BAND_SETS['all'], use_metadata=False)
#
Initialize the ForestNetNonGeo dataset.
| Parameters: |
|
|---|
Source code in terratorch/datasets/forestnet.py
map_label(index)
#
terratorch.datasets.fire_scars
#
FireScarsHLS
#
Bases: RasterDataset
RasterDataset implementation for fire scars input images.
Source code in terratorch/datasets/fire_scars.py
FireScarsNonGeo
#
Bases: NonGeoDataset
NonGeo dataset implementation for fire scars.
Source code in terratorch/datasets/fire_scars.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
__init__(data_root, split='train', bands=BAND_SETS['all'], transform=None, no_data_replace=0, no_label_replace=-1, use_metadata=False)
#
Constructor
| Parameters: |
|
|---|
Source code in terratorch/datasets/fire_scars.py
plot(sample, suptitle=None)
#
Plot a sample from the dataset.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in terratorch/datasets/fire_scars.py
FireScarsSegmentationMask
#
Bases: RasterDataset
RasterDataset implementation for fire scars segmentation mask. Can be easily merged with input images using the & operator.
Source code in terratorch/datasets/fire_scars.py
terratorch.datasets.landslide4sense
#
Landslide4SenseNonGeo
#
Bases: NonGeoDataset
NonGeo dataset implementation for Landslide4Sense.
Source code in terratorch/datasets/landslide4sense.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
__init__(data_root, split='train', bands=BAND_SETS['all'], transform=None)
#
Initialize the Landslide4Sense dataset.
| Parameters: |
|
|---|
Source code in terratorch/datasets/landslide4sense.py
terratorch.datasets.m_eurosat
#
MEuroSATNonGeo
#
Bases: NonGeoDataset
NonGeo dataset implementation for M-EuroSAT.
Source code in terratorch/datasets/m_eurosat.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
__init__(data_root, split='train', bands=BAND_SETS['all'], transform=None, partition='default')
#
Initialize the dataset.
| Parameters: |
|
|---|
Source code in terratorch/datasets/m_eurosat.py
plot(sample, suptitle=None)
#
Plot a sample from the dataset.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in terratorch/datasets/m_eurosat.py
terratorch.datasets.m_bigearthnet
#
MBigEarthNonGeo
#
Bases: NonGeoDataset
NonGeo dataset implementation for M-BigEarthNet.
Source code in terratorch/datasets/m_bigearthnet.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
__init__(data_root, split='train', bands=BAND_SETS['all'], transform=None, partition='default')
#
Initialize the dataset.
| Parameters: |
|
|---|
Source code in terratorch/datasets/m_bigearthnet.py
plot(sample, suptitle=None)
#
Plot a sample from the dataset.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in terratorch/datasets/m_bigearthnet.py
terratorch.datasets.m_brick_kiln
#
MBrickKilnNonGeo
#
Bases: NonGeoDataset
NonGeo dataset implementation for M-BrickKiln.
Source code in terratorch/datasets/m_brick_kiln.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
__init__(data_root, split='train', bands=BAND_SETS['all'], transform=None, partition='default')
#
Initialize the dataset.
| Parameters: |
|
|---|
Source code in terratorch/datasets/m_brick_kiln.py
plot(sample, suptitle=None)
#
Plot a sample from the dataset.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in terratorch/datasets/m_brick_kiln.py
terratorch.datasets.m_forestnet
#
MForestNetNonGeo
#
Bases: NonGeoDataset
NonGeo dataset implementation for M-ForestNet.
Source code in terratorch/datasets/m_forestnet.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | |
__init__(data_root, split='train', bands=BAND_SETS['all'], transform=None, partition='default', use_metadata=False)
#
Initialize the dataset.
| Parameters: |
|
|---|
Source code in terratorch/datasets/m_forestnet.py
plot(sample, suptitle=None)
#
Plot a sample from the dataset.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in terratorch/datasets/m_forestnet.py
terratorch.datasets.m_so2sat
#
MSo2SatNonGeo
#
Bases: NonGeoDataset
NonGeo dataset implementation for M-So2Sat.
Source code in terratorch/datasets/m_so2sat.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
__init__(data_root, split='train', bands=BAND_SETS['all'], transform=None, partition='default')
#
Initialize the dataset.
| Parameters: |
|
|---|
Source code in terratorch/datasets/m_so2sat.py
plot(sample, suptitle=None)
#
Plot a sample from the dataset.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in terratorch/datasets/m_so2sat.py
terratorch.datasets.m_pv4ger
#
MPv4gerNonGeo
#
Bases: NonGeoDataset
NonGeo dataset implementation for M-PV4GER.
Source code in terratorch/datasets/m_pv4ger.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
__init__(data_root, split='train', bands=BAND_SETS['all'], transform=None, partition='default', use_metadata=False)
#
Initialize the dataset.
| Parameters: |
|
|---|
Source code in terratorch/datasets/m_pv4ger.py
plot(sample, suptitle=None)
#
Plot a sample from the dataset.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in terratorch/datasets/m_pv4ger.py
terratorch.datasets.m_cashew_plantation
#
MBeninSmallHolderCashewsNonGeo
#
Bases: NonGeoDataset
NonGeo dataset implementation for M-BeninSmallHolderCashews.
Source code in terratorch/datasets/m_cashew_plantation.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
__init__(data_root, split='train', bands=BAND_SETS['all'], transform=None, partition='default', use_metadata=False)
#
Initialize the dataset.
| Parameters: |
|
|---|
Source code in terratorch/datasets/m_cashew_plantation.py
plot(sample, suptitle=None)
#
Plot a sample from the dataset.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in terratorch/datasets/m_cashew_plantation.py
terratorch.datasets.m_nz_cattle
#
MNzCattleNonGeo
#
Bases: NonGeoDataset
NonGeo dataset implementation for M-NZ-Cattle.
Source code in terratorch/datasets/m_nz_cattle.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
__init__(data_root, split='train', bands=BAND_SETS['all'], transform=None, partition='default', use_metadata=False)
#
Initialize the dataset.
| Parameters: |
|
|---|
Source code in terratorch/datasets/m_nz_cattle.py
plot(sample, suptitle=None)
#
Plot a sample from the dataset.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in terratorch/datasets/m_nz_cattle.py
terratorch.datasets.m_chesapeake_landcover
#
MChesapeakeLandcoverNonGeo
#
Bases: NonGeoDataset
NonGeo dataset implementation for M-ChesapeakeLandcover.
Source code in terratorch/datasets/m_chesapeake_landcover.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
__init__(data_root, split='train', bands=BAND_SETS['all'], transform=None, partition='default')
#
Initialize the dataset.
| Parameters: |
|
|---|
Source code in terratorch/datasets/m_chesapeake_landcover.py
plot(sample, suptitle=None)
#
Plot a sample from the dataset.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in terratorch/datasets/m_chesapeake_landcover.py
terratorch.datasets.m_pv4ger_seg
#
MPv4gerSegNonGeo
#
Bases: NonGeoDataset
NonGeo dataset implementation for M-PV4GER-SEG.
Source code in terratorch/datasets/m_pv4ger_seg.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
__init__(data_root, split='train', bands=BAND_SETS['all'], transform=None, partition='default', use_metadata=False)
#
Initialize the dataset.
| Parameters: |
|
|---|
Source code in terratorch/datasets/m_pv4ger_seg.py
plot(sample, suptitle=None)
#
Plot a sample from the dataset.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in terratorch/datasets/m_pv4ger_seg.py
terratorch.datasets.m_SA_crop_type
#
MSACropTypeNonGeo
#
Bases: NonGeoDataset
NonGeo dataset implementation for M-SA-Crop-Type.
Source code in terratorch/datasets/m_SA_crop_type.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |
__init__(data_root, split='train', bands=BAND_SETS['all'], transform=None, partition='default')
#
Initialize the dataset.
| Parameters: |
|
|---|
Source code in terratorch/datasets/m_SA_crop_type.py
plot(sample, suptitle=None)
#
Plot a sample from the dataset.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in terratorch/datasets/m_SA_crop_type.py
terratorch.datasets.m_neontree
#
MNeonTreeNonGeo
#
Bases: NonGeoDataset
NonGeo dataset implementation for M-NeonTree.
Source code in terratorch/datasets/m_neontree.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
__init__(data_root, split='train', bands=rgb_bands, transform=None, partition='default')
#
Initialize the dataset.
| Parameters: |
|
|---|
Source code in terratorch/datasets/m_neontree.py
plot(sample, suptitle=None)
#
Plot a sample from the dataset.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in terratorch/datasets/m_neontree.py
terratorch.datasets.multi_temporal_crop_classification
#
MultiTemporalCropClassification
#
Bases: NonGeoDataset
NonGeo dataset implementation for multi-temporal crop classification.
Source code in terratorch/datasets/multi_temporal_crop_classification.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | |
__init__(data_root, split='train', bands=BAND_SETS['all'], transform=None, no_data_replace=None, no_label_replace=None, expand_temporal_dimension=True, reduce_zero_label=True, use_metadata=False)
#
Constructor
| Parameters: |
|
|---|
Source code in terratorch/datasets/multi_temporal_crop_classification.py
plot(sample, suptitle=None)
#
Plot a sample from the dataset.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in terratorch/datasets/multi_temporal_crop_classification.py
terratorch.datasets.open_sentinel_map
#
OpenSentinelMap
#
Bases: NonGeoDataset
Pytorch Dataset class to load samples from the OpenSentinelMap dataset, supporting multiple bands and temporal sampling strategies.
Source code in terratorch/datasets/open_sentinel_map.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | |
__init__(data_root, split='train', bands=None, transform=None, spatial_interpolate_and_stack_temporally=True, pad_image=None, truncate_image=None, target=0, pick_random_pair=True)
#
| Parameters: |
|
|---|
Source code in terratorch/datasets/open_sentinel_map.py
terratorch.datasets.openearthmap
#
OpenEarthMapNonGeo
#
Bases: NonGeoDataset
OpenEarthMapNonGeo Dataset for non-georeferenced imagery.
This dataset class handles non-georeferenced image data from the OpenEarthMap dataset. It supports configurable band sets and transformations, and performs cropping operations to ensure that the images conform to the required input dimensions. The dataset is split into "train", "test", and "val" subsets based on the provided split parameter.
Source code in terratorch/datasets/openearthmap.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
__init__(data_root, bands=BAND_SETS['all'], transform=None, split='train', crop_size=256, random_crop=True)
#
Initialize a new instance of the OpenEarthMapNonGeo dataset.
| Parameters: |
|
|---|
| Raises: |
|
|---|
Source code in terratorch/datasets/openearthmap.py
terratorch.datasets.pastis
#
PASTIS
#
Bases: NonGeoDataset
" Pytorch Dataset class to load samples from the PASTIS dataset, for semantic and panoptic segmentation.
Source code in terratorch/datasets/pastis.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | |
__init__(data_root, norm=True, target='semantic', folds=None, reference_date='2018-09-01', date_interval=(-200, 600), class_mapping=None, transform=None, truncate_image=None, pad_image=None, satellites=['S2'])
#
| Parameters: |
|
|---|
Source code in terratorch/datasets/pastis.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
terratorch.datasets.sen1floods11
#
Sen1Floods11NonGeo
#
Bases: NonGeoDataset
NonGeo dataset implementation for sen1floods11.
Source code in terratorch/datasets/sen1floods11.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | |
__init__(data_root, split='train', bands=BAND_SETS['all'], transform=None, constant_scale=0.0001, no_data_replace=0, no_label_replace=-1, use_metadata=False)
#
Constructor
| Parameters: |
|
|---|
Source code in terratorch/datasets/sen1floods11.py
plot(sample, suptitle=None)
#
Plot a sample from the dataset.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in terratorch/datasets/sen1floods11.py
terratorch.datasets.sen4agrinet
#
Sen4AgriNet
#
Bases: NonGeoDataset
Source code in terratorch/datasets/sen4agrinet.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | |
__init__(data_root, bands=None, scenario='random', split='train', transform=None, truncate_image=4, pad_image=4, spatial_interpolate_and_stack_temporally=True, seed=42)
#
Pytorch Dataset class to load samples from the Sen4AgriNet dataset, supporting multiple scenarios for splitting the data.
| Parameters: |
|
|---|
Source code in terratorch/datasets/sen4agrinet.py
terratorch.datasets.sen4map
#
Sen4MapDatasetMonthlyComposites
#
Bases: Dataset
Sen4Map Dataset for Monthly Composites.
Dataset intended for land-cover and crop classification tasks based on monthly composites derived from multi-temporal satellite data stored in HDF5 files.
Dataset Format:
- HDF5 files containing multi-temporal acquisitions with spectral bands (e.g., B2, B3, …, B12)
- Composite images computed as the median across available acquisitions for each month.
- Classification labels provided via HDF5 attributes (e.g., 'lc1') with mappings defined for:
- Land-cover: using
land_cover_classification_map - Crops: using
crop_classification_map
- Land-cover: using
Dataset Features:
- Supports two classification tasks: "land-cover" (default) and "crops".
- Pre-processing options include center cropping, reverse tiling, and resizing.
- Option to save the keys HDF5 for later filtering.
- Input channel selection via a mapping between available bands and input bands.
Source code in terratorch/datasets/sen4map.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | |
__init__(h5py_file_object, h5data_keys=None, crop_size=None, dataset_bands=None, input_bands=None, resize=False, resize_to=[224, 224], resize_interpolation=InterpolationMode.BILINEAR, resize_antialiasing=True, reverse_tile=False, reverse_tile_size=3, save_keys_path=None, classification_map='land-cover')
#
Initialize a new instance of Sen4MapDatasetMonthlyComposites.
This dataset loads data from an HDF5 file object containing multi-temporal satellite data and computes monthly composite images by aggregating acquisitions (via median).
| Parameters: |
|
|---|
| Raises: |
|
|---|
Source code in terratorch/datasets/sen4map.py
reverse_tiling_pytorch(img_tensor, kernel_size=3)
#
Upscales an image where every pixel is expanded into kernel_size*kernel_size pixels.
Used to test whether the benefit of resizing images to the pre-trained size comes from the bilnearly interpolated pixels,
or if the same would be realized with no interpolated pixels.
Source code in terratorch/datasets/sen4map.py
Datamodules#
terratorch.datamodules.biomassters
#
BioMasstersNonGeoDataModule
#
Bases: NonGeoDataModule
NonGeo LightningDataModule implementation for BioMassters datamodule.
Source code in terratorch/datamodules/biomassters.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | |
__init__(data_root, batch_size=4, num_workers=0, bands=BioMasstersNonGeo.all_band_names, train_transform=None, val_transform=None, test_transform=None, predict_transform=None, aug=None, drop_last=True, sensors=['S1', 'S2'], as_time_series=False, metadata_filename=default_metadata_filename, max_cloud_percentage=None, max_red_mean=None, include_corrupt=True, subset=1, seed=42, use_four_frames=False, **kwargs)
#
Initializes the DataModule for the non-geospatial BioMassters datamodule.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in terratorch/datamodules/biomassters.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
setup(stage)
#
Set up datasets.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/biomassters.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | |
terratorch.datamodules.burn_intensity
#
BurnIntensityNonGeoDataModule
#
Bases: NonGeoDataModule
NonGeo LightningDataModule implementation for BurnIntensity datamodule.
Source code in terratorch/datamodules/burn_intensity.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |
__init__(data_root, batch_size=4, num_workers=0, bands=BurnIntensityNonGeo.all_band_names, train_transform=None, val_transform=None, test_transform=None, predict_transform=None, use_full_data=True, no_data_replace=0.0001, no_label_replace=-1, use_metadata=False, **kwargs)
#
Initializes the DataModule for the BurnIntensity non-geospatial datamodule.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/burn_intensity.py
setup(stage)
#
Set up datasets.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/burn_intensity.py
terratorch.datamodules.carbonflux
#
CarbonFluxNonGeoDataModule
#
Bases: NonGeoDataModule
NonGeo LightningDataModule implementation for Carbon FLux dataset.
Source code in terratorch/datamodules/carbonflux.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
__init__(data_root, batch_size=4, num_workers=0, bands=CarbonFluxNonGeo.all_band_names, train_transform=None, val_transform=None, test_transform=None, predict_transform=None, aug=None, no_data_replace=0.0001, use_metadata=False, **kwargs)
#
Initializes the CarbonFluxNonGeoDataModule.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/carbonflux.py
setup(stage)
#
Set up datasets.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/carbonflux.py
terratorch.datamodules.forestnet
#
ForestNetNonGeoDataModule
#
Bases: NonGeoDataModule
NonGeo LightningDataModule implementation for Landslide4Sense dataset.
Source code in terratorch/datamodules/forestnet.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |
__init__(data_root, batch_size=4, num_workers=0, label_map=ForestNetNonGeo.default_label_map, bands=ForestNetNonGeo.all_band_names, train_transform=None, val_transform=None, test_transform=None, predict_transform=None, fraction=1.0, aug=None, use_metadata=False, **kwargs)
#
Initializes the ForestNetNonGeoDataModule.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/forestnet.py
setup(stage)
#
Set up datasets.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/forestnet.py
terratorch.datamodules.fire_scars
#
FireScarsDataModule
#
Bases: GeoDataModule
Geo Fire Scars data module implementation that merges input data with ground truth segmentation masks.
Source code in terratorch/datamodules/fire_scars.py
FireScarsNonGeoDataModule
#
Bases: NonGeoDataModule
NonGeo LightningDataModule implementation for Fire Scars dataset.
Source code in terratorch/datamodules/fire_scars.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
__init__(data_root, batch_size=4, num_workers=0, bands=FireScarsNonGeo.all_band_names, train_transform=None, val_transform=None, test_transform=None, predict_transform=None, drop_last=True, no_data_replace=0, no_label_replace=-1, use_metadata=False, **kwargs)
#
Initializes the FireScarsNonGeoDataModule.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/fire_scars.py
setup(stage)
#
Set up datasets.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/fire_scars.py
terratorch.datamodules.landslide4sense
#
Landslide4SenseNonGeoDataModule
#
Bases: NonGeoDataModule
NonGeo LightningDataModule implementation for Landslide4Sense dataset.
Source code in terratorch/datamodules/landslide4sense.py
__init__(data_root, batch_size=4, num_workers=0, bands=Landslide4SenseNonGeo.all_band_names, train_transform=None, val_transform=None, test_transform=None, predict_transform=None, aug=None, **kwargs)
#
Initializes the Landslide4SenseNonGeoDataModule.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/landslide4sense.py
setup(stage)
#
Set up datasets.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/landslide4sense.py
terratorch.datamodules.m_eurosat
#
MEuroSATNonGeoDataModule
#
Bases: GeobenchDataModule
NonGeo LightningDataModule implementation for M-EuroSAT dataset.
Source code in terratorch/datamodules/m_eurosat.py
__init__(batch_size=8, num_workers=0, data_root='./', bands=None, train_transform=None, val_transform=None, test_transform=None, aug=None, partition='default', **kwargs)
#
Initializes the MEuroSATNonGeoDataModule for the MEuroSATNonGeo dataset.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/m_eurosat.py
terratorch.datamodules.m_bigearthnet
#
MBigEarthNonGeoDataModule
#
Bases: GeobenchDataModule
NonGeo LightningDataModule implementation for M-BigEarthNet dataset.
Source code in terratorch/datamodules/m_bigearthnet.py
__init__(batch_size=8, num_workers=0, data_root='./', bands=None, train_transform=None, val_transform=None, test_transform=None, aug=None, partition='default', **kwargs)
#
Initializes the MBigEarthNonGeoDataModule for the M-BigEarthNet dataset.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/m_bigearthnet.py
terratorch.datamodules.m_brick_kiln
#
MBrickKilnNonGeoDataModule
#
Bases: GeobenchDataModule
NonGeo LightningDataModule implementation for M-BrickKiln dataset.
Source code in terratorch/datamodules/m_brick_kiln.py
__init__(batch_size=8, num_workers=0, data_root='./', bands=None, train_transform=None, val_transform=None, test_transform=None, aug=None, partition='default', **kwargs)
#
Initializes the MBrickKilnNonGeoDataModule for the M-BrickKilnNonGeo dataset.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/m_brick_kiln.py
terratorch.datamodules.m_forestnet
#
MForestNetNonGeoDataModule
#
Bases: GeobenchDataModule
NonGeo LightningDataModule implementation for M-ForestNet dataset.
Source code in terratorch/datamodules/m_forestnet.py
__init__(batch_size=8, num_workers=0, data_root='./', bands=None, train_transform=None, val_transform=None, test_transform=None, aug=None, partition='default', use_metadata=False, **kwargs)
#
Initializes the MForestNetNonGeoDataModule for the MForestNetNonGeo dataset.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/m_forestnet.py
terratorch.datamodules.m_so2sat
#
MSo2SatNonGeoDataModule
#
Bases: GeobenchDataModule
NonGeo LightningDataModule implementation for M-So2Sat dataset.
Source code in terratorch/datamodules/m_so2sat.py
__init__(batch_size=8, num_workers=0, data_root='./', bands=None, train_transform=None, val_transform=None, test_transform=None, aug=None, partition='default', **kwargs)
#
Initializes the MSo2SatNonGeoDataModule for the MSo2SatNonGeo dataset.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/m_so2sat.py
terratorch.datamodules.m_pv4ger
#
MPv4gerNonGeoDataModule
#
Bases: GeobenchDataModule
NonGeo LightningDataModule implementation for M-Pv4ger dataset.
Source code in terratorch/datamodules/m_pv4ger.py
__init__(batch_size=8, num_workers=0, data_root='./', bands=None, train_transform=None, val_transform=None, test_transform=None, aug=None, partition='default', use_metadata=False, **kwargs)
#
Initializes the MPv4gerNonGeoDataModule for the MPv4gerNonGeo dataset.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/m_pv4ger.py
terratorch.datamodules.m_cashew_plantation
#
MBeninSmallHolderCashewsNonGeoDataModule
#
Bases: GeobenchDataModule
NonGeo LightningDataModule implementation for M-Cashew Plantation dataset.
Source code in terratorch/datamodules/m_cashew_plantation.py
__init__(batch_size=8, num_workers=0, data_root='./', bands=None, train_transform=None, val_transform=None, test_transform=None, aug=None, partition='default', use_metadata=False, **kwargs)
#
Initializes the MBeninSmallHolderCashewsNonGeoDataModule for the M-BeninSmallHolderCashewsNonGeo dataset.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/m_cashew_plantation.py
terratorch.datamodules.m_nz_cattle
#
MNzCattleNonGeoDataModule
#
Bases: GeobenchDataModule
NonGeo LightningDataModule implementation for M-NZCattle dataset.
Source code in terratorch/datamodules/m_nz_cattle.py
__init__(batch_size=8, num_workers=0, data_root='./', bands=None, train_transform=None, val_transform=None, test_transform=None, aug=None, partition='default', use_metadata=False, **kwargs)
#
Initializes the MNzCattleNonGeoDataModule for the MNzCattleNonGeo dataset.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/m_nz_cattle.py
terratorch.datamodules.m_chesapeake_landcover
#
MChesapeakeLandcoverNonGeoDataModule
#
Bases: GeobenchDataModule
NonGeo LightningDataModule implementation for M-ChesapeakeLandcover dataset.
Source code in terratorch/datamodules/m_chesapeake_landcover.py
__init__(batch_size=8, num_workers=0, data_root='./', bands=None, train_transform=None, val_transform=None, test_transform=None, aug=None, partition='default', **kwargs)
#
Initializes the MChesapeakeLandcoverNonGeoDataModule for the M-BigEarthNet dataset.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/m_chesapeake_landcover.py
terratorch.datamodules.m_pv4ger_seg
#
MPv4gerSegNonGeoDataModule
#
Bases: GeobenchDataModule
NonGeo LightningDataModule implementation for M-Pv4gerSeg dataset.
Source code in terratorch/datamodules/m_pv4ger_seg.py
__init__(batch_size=8, num_workers=0, data_root='./', bands=None, train_transform=None, val_transform=None, test_transform=None, aug=None, partition='default', use_metadata=False, **kwargs)
#
Initializes the MPv4gerNonGeoDataModule for the MPv4gerSegNonGeo dataset.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/m_pv4ger_seg.py
terratorch.datamodules.m_SA_crop_type
#
MSACropTypeNonGeoDataModule
#
Bases: GeobenchDataModule
NonGeo LightningDataModule implementation for M-SA-CropType dataset.
Source code in terratorch/datamodules/m_SA_crop_type.py
__init__(batch_size=8, num_workers=0, data_root='./', bands=None, train_transform=None, val_transform=None, test_transform=None, aug=None, partition='default', **kwargs)
#
Initializes the MSACropTypeNonGeoDataModule for the MSACropTypeNonGeo dataset.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/m_SA_crop_type.py
terratorch.datamodules.m_neontree
#
MNeonTreeNonGeoDataModule
#
Bases: GeobenchDataModule
NonGeo LightningDataModule implementation for M-NeonTree dataset.
Source code in terratorch/datamodules/m_neontree.py
__init__(batch_size=8, num_workers=0, data_root='./', bands=None, train_transform=None, val_transform=None, test_transform=None, aug=None, partition='default', **kwargs)
#
Initializes the MNeonTreeNonGeoDataModule for the MNeonTreeNonGeo dataset.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/m_neontree.py
terratorch.datamodules.multi_temporal_crop_classification
#
MultiTemporalCropClassificationDataModule
#
Bases: NonGeoDataModule
NonGeo LightningDataModule implementation for multi-temporal crop classification.
Source code in terratorch/datamodules/multi_temporal_crop_classification.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
__init__(data_root, batch_size=4, num_workers=0, bands=MultiTemporalCropClassification.all_band_names, train_transform=None, val_transform=None, test_transform=None, predict_transform=None, drop_last=True, no_data_replace=0, no_label_replace=-1, expand_temporal_dimension=True, reduce_zero_label=True, use_metadata=False, **kwargs)
#
Initializes the MultiTemporalCropClassificationDataModule for multi-temporal crop classification.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/multi_temporal_crop_classification.py
setup(stage)
#
Set up datasets.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/multi_temporal_crop_classification.py
terratorch.datamodules.open_sentinel_map
#
OpenSentinelMapDataModule
#
Bases: NonGeoDataModule
NonGeo LightningDataModule implementation for Open Sentinel Map.
Source code in terratorch/datamodules/open_sentinel_map.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
__init__(bands=None, batch_size=8, num_workers=0, data_root='./', train_transform=None, val_transform=None, test_transform=None, predict_transform=None, spatial_interpolate_and_stack_temporally=True, pad_image=None, truncate_image=None, **kwargs)
#
Initializes the OpenSentinelMapDataModule for the Open Sentinel Map dataset.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/open_sentinel_map.py
setup(stage)
#
Set up datasets.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/open_sentinel_map.py
terratorch.datamodules.openearthmap
#
OpenEarthMapNonGeoDataModule
#
Bases: NonGeoDataModule
NonGeo LightningDataModule implementation for Open Earth Map.
Source code in terratorch/datamodules/openearthmap.py
__init__(batch_size=8, num_workers=0, data_root='./', train_transform=None, val_transform=None, test_transform=None, predict_transform=None, aug=None, **kwargs)
#
Initializes the OpenEarthMapNonGeoDataModule for the Open Earth Map dataset.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/openearthmap.py
setup(stage)
#
Set up datasets.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/openearthmap.py
terratorch.datamodules.pastis
#
PASTISDataModule
#
Bases: NonGeoDataModule
NonGeo LightningDataModule implementation for PASTIS.
Source code in terratorch/datamodules/pastis.py
__init__(batch_size=8, num_workers=0, data_root='./', truncate_image=None, pad_image=None, train_transform=None, val_transform=None, test_transform=None, predict_transform=None, **kwargs)
#
Initializes the PASTISDataModule for the PASTIS dataset.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/pastis.py
setup(stage)
#
Set up datasets.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/pastis.py
terratorch.datamodules.sen1floods11
#
Sen1Floods11NonGeoDataModule
#
Bases: NonGeoDataModule
NonGeo LightningDataModule implementation for Fire Scars.
Source code in terratorch/datamodules/sen1floods11.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | |
__init__(data_root, batch_size=4, num_workers=0, bands=Sen1Floods11NonGeo.all_band_names, train_transform=None, val_transform=None, test_transform=None, predict_transform=None, drop_last=True, constant_scale=0.0001, no_data_replace=0, no_label_replace=-1, use_metadata=False, **kwargs)
#
Initializes the Sen1Floods11NonGeoDataModule.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/sen1floods11.py
setup(stage)
#
Set up datasets.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/sen1floods11.py
terratorch.datamodules.sen4agrinet
#
Sen4AgriNetDataModule
#
Bases: NonGeoDataModule
NonGeo LightningDataModule implementation for Sen4AgriNet.
Source code in terratorch/datamodules/sen4agrinet.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
__init__(bands=None, batch_size=8, num_workers=0, data_root='./', train_transform=None, val_transform=None, test_transform=None, predict_transform=None, seed=42, scenario='random', requires_norm=True, binary_labels=False, linear_encoder=None, **kwargs)
#
Initializes the Sen4AgriNetDataModule for the Sen4AgriNet dataset.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/sen4agrinet.py
setup(stage)
#
Set up datasets.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/sen4agrinet.py
terratorch.datamodules.sen4map
#
Sen4MapLucasDataModule
#
Bases: LightningDataModule
NonGeo LightningDataModule implementation for Sen4map.
Source code in terratorch/datamodules/sen4map.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | |
__init__(batch_size, num_workers, prefetch_factor=0, train_hdf5_path=None, train_hdf5_keys_path=None, test_hdf5_path=None, test_hdf5_keys_path=None, val_hdf5_path=None, val_hdf5_keys_path=None, **kwargs)
#
Initializes the Sen4MapLucasDataModule for handling Sen4Map monthly composites.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/sen4map.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
setup(stage)
#
Set up datasets.
| Parameters: |
|
|---|
Source code in terratorch/datamodules/sen4map.py
Transforms#
The transforms module provides a set of specialized image transformations designed to manipulate spatial, temporal, and multimodal data efficiently. These transformations allow for greater flexibility when working with multi-temporal, multi-channel, and multi-modal datasets, ensuring that data can be formatted appropriately for different model architectures.
terratorch.datasets.transforms
#
FlattenSamplesIntoChannels
#
Bases: ImageOnlyTransform
FlattenSamplesIntoChannels is an image transformation that merges the sample (and optionally temporal) dimensions into the channel dimension.
This transform rearranges an input tensor by flattening the sample dimension, and if specified, also the temporal dimension, thereby concatenating these dimensions into a single channel dimension.
Source code in terratorch/datasets/transforms.py
__init__(time_dim=True)
#
Initialize the FlattenSamplesIntoChannels transform.
| Parameters: |
|
|---|
Source code in terratorch/datasets/transforms.py
FlattenTemporalIntoChannels
#
Bases: ImageOnlyTransform
FlattenTemporalIntoChannels is an image transformation that flattens the temporal dimension into the channel dimension.
This transform rearranges an input tensor with a temporal dimension into one where the time and channel dimensions are merged. It expects the input to have a fixed number of dimensions defined by N_DIMS_FOR_TEMPORAL.
Source code in terratorch/datasets/transforms.py
MultimodalTransforms
#
MultimodalTransforms applies albumentations transforms to multiple image modalities.
This class supports both shared transformations across modalities and separate transformations for each modality. It also handles non-image modalities by applying a specified non-image transform.
Source code in terratorch/datasets/transforms.py
__init__(transforms, shared=True, non_image_modalities=None, non_image_transform=None)
#
Initialize the MultimodalTransforms.
| Parameters: |
|
|---|
Source code in terratorch/datasets/transforms.py
Padding
#
Bases: ImageOnlyTransform
Padding to adjust (slight) discrepancies between input images
Source code in terratorch/datasets/transforms.py
Rearrange
#
Bases: ImageOnlyTransform
Rearrange is a generic image transformation that reshapes an input tensor using a custom einops pattern.
This transform allows flexible reordering of tensor dimensions based on the provided pattern and arguments.
Source code in terratorch/datasets/transforms.py
__init__(rearrange, rearrange_args=None, always_apply=True, p=1)
#
Initialize the Rearrange transform.
| Parameters: |
|
|---|
Source code in terratorch/datasets/transforms.py
SelectBands
#
Bases: ImageOnlyTransform
SelectBands is an image transformation that selects a subset of bands (channels) from an input image.
This transform uses specified band indices to filter and output only the desired channels from the image tensor.
Source code in terratorch/datasets/transforms.py
__init__(band_indices)
#
Initialize the SelectBands transform.
| Parameters: |
|
|---|
Source code in terratorch/datasets/transforms.py
UnflattenSamplesFromChannels
#
Bases: ImageOnlyTransform
UnflattenSamplesFromChannels is an image transformation that restores the sample (and optionally temporal) dimensions from the channel dimension.
This transform is designed to reverse the flattening performed by FlattenSamplesIntoChannels and is typically applied after converting images to a channels-first format.
Source code in terratorch/datasets/transforms.py
__init__(time_dim=True, n_samples=None, n_timesteps=None, n_channels=None)
#
Initialize the UnflattenSamplesFromChannels transform.
| Parameters: |
|
|---|
| Raises: |
|
|---|
Source code in terratorch/datasets/transforms.py
UnflattenTemporalFromChannels
#
Bases: ImageOnlyTransform
UnflattenTemporalFromChannels is an image transformation that restores the temporal dimension from the channel dimension.
This transform is typically applied after converting images to a channels-first format (e.g., after ToTensorV2) and rearranges the flattened temporal information back into separate time and channel dimensions.